Plotting problem 3a (Pillow section 3point4).mws

Plotting points.

The plot command can also plot one or more points.

Example 1:

Plot the point (2,3) .  Note in the following line that we use two sets of square brackets.

> plot([ [2,3] ],style=point);

[Maple Plot]

Example 2:

We can control the size of the x and y ranges shown by adding these to the command as in the next line.

> plot([ [2,3] ],x=-7..7,y=-7..7,style=point);

[Maple Plot]

Example 3:

To graph more than one point list them in the plot command. Note the commas. Remember square brackets for each point and an extra pair of square brackets surround the list.

> plot([ [2,3],[-2,5],[1,-4] ],x=-7..7,y=-7..7,style=point);

[Maple Plot]

Example 4:

Changing style to "line" connects the points in the order listed.

> plot([ [2,3],[-2,5],[1,-4] ],x=-7..7,y=-7..7,style=line);

[Maple Plot]

Example 5:

Optional extensions can be used to specify point color and symbol (e.g. diamond, circle, cross is default) to indicate the points.

> plot([[3,2],[-2,3],[2,-1]],style=point,color=blue,symbol=circle);

[Maple Plot]

Exercise 3.4

Plot the following points using the color red and the diamond symbol: [1,4] , [-2,-3], [4,-5] and [-6,5] .  Then connect the points with lines in a separate plot command.

Student Workspace 3.4

 

Answer 3.4

> plot([[1,4],[-2,-3],[4,-5],[-6,5]],style=point,color=red,symbol=diamond);

[Maple Plot]

> plot([[1,4],[-2,-3],[4,-5],[-6,5]],style=line,color=red,symbol=diamond);

[Maple Plot]